package com.systop.asset.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.systop.asset.entity.RepairDetail;
import com.systop.asset.entity.RestResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.systop.asset.service.IRepairDetailService;

/**
 * 资产维修记录详情Controller
 * 
 * @author cc
 * @date 2025-07-07
 */
@RestController
@RequestMapping("/system/repair_detail")
public class RepairDetailController
{
    @Autowired
    private IRepairDetailService repairDetailService;

    /**
     * 查询资产维修记录详情列表
     */
    @GetMapping("/list")
    public RestResponse list(RepairDetail repairDetail)
    {
        List<RepairDetail> list = repairDetailService.selectRepairDetailList(repairDetail);
        return RestResponse.success(list);
    }


    /**
     * 获取资产维修记录详情详细信息
     */
    @GetMapping(value = "/{id}")
    public RestResponse getInfo(@PathVariable("id") Long id)
    {
        return RestResponse.success(repairDetailService.selectRepairDetailById(id));
    }

    /**
     * 新增资产维修记录详情
     */
    @PostMapping
    public RestResponse add(@RequestBody RepairDetail repairDetail)
    {
        return RestResponse.success(repairDetailService.insertRepairDetail(repairDetail));
    }

    /**
     * 修改资产维修记录详情
     */
    @PutMapping
    public RestResponse edit(@RequestBody RepairDetail repairDetail)
    {
        return RestResponse.success(repairDetailService.updateRepairDetail(repairDetail));
    }

    /**
     * 删除资产维修记录详情
     */
	@DeleteMapping("/{ids}")
    public RestResponse remove(@PathVariable Long[] ids)
    {
        return RestResponse.success(repairDetailService.deleteRepairDetailByIds(ids));
    }
}
